package org.apache.ibatis.common.reflection;

import org.apache.ibatis.common.reflection.factory.DefaultObjectFactory;
import org.apache.ibatis.common.reflection.factory.ObjectFactory;
import org.apache.ibatis.common.reflection.wrapper.DefaultObjectWrapperFactory;
import org.apache.ibatis.common.reflection.wrapper.ObjectWrapperFactory;
import org.omg.CORBA.PUBLIC_MEMBER;

/**
 * @Name SystemMetaObject
 * @Description: 系统内置 “元” 对象
 * 描述信息：主要提供一些默认的 “元” 对象，包括 NullObject 空对象，以及一些默认使用 DefaultObjectFactory、DefaultObjectWrapperFactory、DefaultReflectorFactory 类的 “元” 对象。
 * @Version v1.0.0
 * @Author: lichao
 * @Date: 2024-04-28 14:56:00
 **/
public class SystemMetaObject {
    public static final ObjectFactory DEFAULT_OBJECT_FACTORY = new DefaultObjectFactory();
    public static final ObjectWrapperFactory DEFAULT_OBJECT_WRAPPER_FACTORY = new DefaultObjectWrapperFactory();
    public static final ReflectorFactory DEFAULT_REFLECTOR_FACTORY = new DefaultReflectorFactory();
    public static final MetaObject NULL_META_OBJECT = MetaObject.forObject(NullObject.class, DEFAULT_OBJECT_FACTORY, DEFAULT_OBJECT_WRAPPER_FACTORY, DEFAULT_REFLECTOR_FACTORY);

    private SystemMetaObject() {
    }

    private static class NullObject {
    }

    public static MetaObject forObject(Object object) {
        return MetaObject.forObject(object, DEFAULT_OBJECT_FACTORY, DEFAULT_OBJECT_WRAPPER_FACTORY, DEFAULT_REFLECTOR_FACTORY);
    }

}

